#ifndef __BSP_CAN_H__
#define __BSP_CAN_H__

#include "stm32f4xx_can.h"

#define CAN1_H_Pin          	        GPIO_Pin_12
#define CAN1_H_PINSOURCE		        GPIO_PinSource12

#define CAN1_L_Pin           	    	GPIO_Pin_11
#define CAN1_L_PINSOURCE		        GPIO_PinSource11


#define CAN1_GPIO_PORT                  GPIOA
#define CAN1_GPIO_CLK          	        RCC_AHB1Periph_GPIOA
#define CAN1_CLK                        RCC_APB1Periph_CAN1


#define CAN1_SJW		                CAN_SJW_1tq
#define CAN1_BS1		                CAN_BS1_9tq
#define CAN1_BS2	                	CAN_BS2_4tq
#define CAN1_Prescaler	                12




#define CAN2_GPIO_PORT                  GPIOB
#define CAN2_TX_Pin          	    	GPIO_Pin_12
#define CAN2_TX_PINSOURCE		      	GPIO_PinSource12

#define CAN2_RX_Pin           	     	GPIO_Pin_13
#define CAN2_RX_PINSOURCE		      	GPIO_PinSource13


#define CAN2_GPIO_CLK          	        RCC_AHB1Periph_GPIOB
#define CAN2_CLK                        RCC_APB1Periph_CAN2

#define CAN2_SJW		                CAN_SJW_1tq
#define CAN2_BS1		                CAN_BS1_9tq
#define CAN2_BS2	                	CAN_BS2_4tq
#define CAN2_Prescaler	                60  //50k


#define MAIN_CAN_ID                     0x200

#define MASTER_ID                       0x300
#define CONTROL_ID                      0x200



void BSP_CAN_Config(void);
void CAN1_TX_EXTID(uint32_t CAN_ID,uint8_t cantxbuf[],uint8_t len);
void CAN1_TX_PACKET(unsigned int CAN_ID,unsigned char cantxbuf[],unsigned char len);
void CAN2_TX_EXTID(uint32_t CAN_ID,uint8_t cantxbuf[],uint8_t len);
void CAN2_TX_PACKET(unsigned int CAN_ID,unsigned char cantxbuf[],unsigned char len);


#endif




